package demo;

/**
 * @description:
 * @author: GX
 * @time: 2025/10/30 15:43
 */
public class threadTest {
    public static void main(String[] args) {
        for (int i = 1; i <= 5; i++) {
            MyThread myThread = new MyThread(i); // 将 i 传入
            myThread.start();
            System.out.println("主线程：" + i);
        }
        System.out.println("主线程结束");
    }
}

class MyThread extends Thread {
    private int number;

    public MyThread(int number) {
        this.number = number;
    }

    @Override
    public void run() {
        System.out.println("分支线程收到的参数：" + number);
    }
}